﻿using T4UtilityBelt.Writers;

namespace T4UtilityBelt.UxDesigns.Controls.Renderers.Android
{
    public class GridRenderer : ControlRenderer<GridControl, IGridRenderer>, IGridRenderer
    {
        protected override void OnRenderUiXmlBegin(GridControl control, CodeWriter writer)
        {
            writer.WriteBeginTag("TableLayout");
            RenderFirstElementAttributes(writer);
            RenderControlAttributes(control, writer);
            writer.WriteEnd();
        }

        protected override void OnRenderUiXmlContent(GridControl control, CodeWriter writer)
        {
            foreach (GridRow c in control.Rows)
            {
                c.RenderUiXml(writer);
            }
        }


        protected override void OnRenderUiXmlEnd(GridControl control, CodeWriter writer)
        {
            writer.WriteEndTag("TableLayout");
        }
    }
}